package com.kelp.codetoolkit.service

import com.intellij.openapi.project.Project
import com.intellij.psi.PsiJavaFile
import com.kelp.codetoolkit.enums.ServerPackageEnum
import com.kelp.codetoolkit.ui.form.MethodParamsSettingDialog

/**
 * @author: liuyuebai
 * @date: 2025/1/13 15:33
 * @description:
 */

interface MethodHandleService {

    companion object{
        fun getInstance(project: Project): MethodHandleService{
            return project.getService(MethodHandleService::class.java)
        }
    }

    /**
     * 写入方法 当前文件为Service文件，currentJavaFile=xxService.Java
     */
    fun handleService(project: Project, currentJavaFile: PsiJavaFile, methodContent: MethodParamsSettingDialog)

    /**
     * 写入方法 当前文件非Service文件，selectJavaFile可能是dao文件、serviceImpl、或其他文件
     */
    fun handleService(project: Project, methodContent: MethodParamsSettingDialog, selectJavaFile: PsiJavaFile, selectClassName:String, selectPackageEnum: ServerPackageEnum)

    /**
     * 写入方法 当前文件非Provider文件，生成service
     */
    fun handleProviderToService(project: Project, methodContent: MethodParamsSettingDialog, selectJavaFile: PsiJavaFile, selectClassName:String, selectPackageEnum: ServerPackageEnum)

    /**
     * 写入方法 当前文件为JavaMapper文件
     */
    fun handleJavaMapper(project: Project, currentJavaFile: PsiJavaFile, methodContent: MethodParamsSettingDialog)

    /**
     * 写入方法 当前文件非JavaMapper文件，selectJavaFile可能是dao文件、serviceImpl、或其他文件
     */
    fun handleJavaMapper(project: Project, methodContent: MethodParamsSettingDialog, selectJavaFile: PsiJavaFile, selectClassName:String, selectPackageEnum: ServerPackageEnum)

    /**
     * 写入方法 当前文件非Provider文件，生成service
     */
    fun handleProviderToJavaMapper(project: Project, methodContent: MethodParamsSettingDialog, selectJavaFile: PsiJavaFile, selectClassName:String, selectPackageEnum: ServerPackageEnum)

    /**
     * 写入方法 当前文件为Service文件，currentJavaFile=xxService.Java
     */
    fun handleServiceImpl(project: Project, currentJavaFile: PsiJavaFile, methodContent: MethodParamsSettingDialog)

    /**
     * 写入方法 当前文件非Service文件，selectJavaFile可能是dao文件、serviceImpl、或其他文件
     */
    fun handleServiceImpl(project: Project, methodContent: MethodParamsSettingDialog, selectJavaFile: PsiJavaFile, selectClassName:String, selectPackageEnum: ServerPackageEnum)

    /**
     * 写入方法 当前文件非Provider文件，生成service
     */
    fun handleProviderToServiceImpl(project: Project, methodContent: MethodParamsSettingDialog, selectJavaFile: PsiJavaFile, selectClassName:String, selectPackageEnum: ServerPackageEnum)

    /**
     * 写入方法 当前文件为Service文件，currentJavaFile=xxService.Java
     */
    fun handleProviderImpl(project: Project, currentJavaFile: PsiJavaFile, methodContent: MethodParamsSettingDialog)

    /**
     * 写入方法 当前文件非Service文件，selectJavaFile可能是dao文件、serviceImpl、或其他文件
     */
    fun handleProviderImpl(project: Project, methodContent: MethodParamsSettingDialog, selectJavaFile: PsiJavaFile, selectClassName:String, selectPackageEnum: ServerPackageEnum)

    /**
     * 写入方法 当前文件非Provider文件，生成service
     */
    fun handleProviderToProviderImpl(project: Project, methodContent: MethodParamsSettingDialog, selectJavaFile: PsiJavaFile, selectClassName:String, selectPackageEnum: ServerPackageEnum)

    /**
     * 写入方法 当前文件为Service文件，currentJavaFile=xxService.Java
     */
    fun handleProvider(project: Project, currentJavaFile: PsiJavaFile, methodContent: MethodParamsSettingDialog)

    /**
     * 写入方法 当前文件非Service文件，selectJavaFile可能是dao文件、serviceImpl、或其他文件
     */
    fun handleProvider(project: Project, methodContent: MethodParamsSettingDialog, selectJavaFile: PsiJavaFile, selectClassName:String, selectPackageEnum: ServerPackageEnum)

    /**
     * 写入方法 当前文件为Service文件，currentJavaFile=xxService.Java
     */
    fun handleController(project: Project, currentJavaFile: PsiJavaFile, methodContent: MethodParamsSettingDialog)

    /**
     * 写入方法 当前文件非Service文件，selectJavaFile可能是dao文件、serviceImpl、或其他文件
     */
    fun handleController(project: Project, methodContent: MethodParamsSettingDialog, selectJavaFile: PsiJavaFile, selectClassName:String, selectPackageEnum: ServerPackageEnum)

    /**
     * 写入方法 当前文件非Service文件，selectJavaFile可能是dao文件、serviceImpl、或其他文件
     */
    fun handleMapperXml(project: Project, psiJavaFile: PsiJavaFile, methodContent:MethodParamsSettingDialog, fileName:String)

    /**
     * 写入方法 当前文件非Service文件，selectJavaFile可能是dao文件、serviceImpl、或其他文件
     */
    fun handleProviderToMapperXml(project: Project, psiJavaFile: PsiJavaFile, methodContent:MethodParamsSettingDialog, fileName:String)
}